home *** CD-ROM | disk | FTP | other *** search
- Path: news.interlog.com!news
- From: kingkaos@interlog.com (King Kaos)
- Newsgroups: comp.lang.c
- Subject: Why won't this compile????
- Date: 17 Feb 1996 16:41:01 GMT
- Organization: Interlog
- Message-ID: <4g50et$9lh@steel.interlog.com>
- NNTP-Posting-Host: kingkaos.interlog.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
-
- Hi. Can someone please explain why this program won't
- compile without errors? I am using Power C under DOS.
-
-
- Heres the ANSI-C code:
-
- #include <stdio.h>
- #include <stdlib.h>
-
- void swap(int *, int *);
-
- main()
- {
- int var1, var2;
-
- var1 = 25;
- var2 = 99;
- printf("Variables before swap");
- printf("var1 = %d , var2 = %d\n",var1,var2);
-
- swap(&var1, &var2);
- printf("Variables after swap");
- printf("var1 = %d , var2 = %d\n,var1,var2);
- }
-
- void swap(int *ptr1,int *ptr2)
- {
- int temp;
- temp = *ptr1;
- *ptr1 = *ptr2;
- *ptr2 = temp;
- }
-
- -----------------------------
- And, heres the C.ERR file:
-
- pointc~1.txt(18):}
- **************** ^202
- 202: String constant cannot span lines
- ------------------------------------------------------------
- pointc~1.txt(20):void swap(int *ptr1,int *ptr2)
- **************** ^ 4, 14 ^ 6 ^104,222, 6,104,222
- 4: ')' expected
- 14: ';' expected
- 6: Illegal symbol
- 104: Undeclared identifier
- 222: Warning - Pointer does not match scalar (int, long, etc)
- ------------------------------------------------------------
- pointc~1.txt(21):{
- **************** ^ 14
- 14: ';' expected
- ------------------------------------------------------------
- pointc~1.txt(23): temp = *ptr1;
- **************** ^104,141
- 104: Undeclared identifier
- 141: Type of variable is not pointer
- ------------------------------------------------------------
- pointc~1.txt(24): *ptr1 = *ptr2;
- **************** ^104,141,104,141
- 104: Undeclared identifier
- 141: Type of variable is not pointer
- ------------------------------------------------------------
- pointc~1.txt(25): *ptr2 = temp;
- **************** ^104,141
- 104: Undeclared identifier
- 141: Type of variable is not pointer
- ------------------------------------------------------------
- pointc~1.txt(26):}
- **************** ^ 9
- 9: Right braces expected
- ------------------------------------------------------------
-
-
- Any help will be appericated. Please email respones directly to
- me. Thank's.
-
-
-
- KING KAOS
-
-